/**
 * @Created Apr 5, 2011 11:03:53 AM
 * @author cry30
 */
package com.philip.journal.core.dao.spring;

import static org.mockito.Mockito.mock;

import org.springframework.beans.factory.FactoryBean;

/**
 * Spring mock factory.
 */
public class MockFactory implements FactoryBean<Object> {

    /** The created object type. */
    private transient Class<Object> type;

    @Override
	public Object getObject() throws Exception {// NOPMD Override
        return mock(type);
    }

    @Override
    public Class<?> getObjectType() {
        return type;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }

    public void setType(final Class<Object> pType) {
        this.type = pType;
    }
}
